package com.danger.Util;

/**
 * Created by danger on 2016/3/31.
 */
public class CheckCode {

    private final static String APPKEY_IS_NULL = "Application Id为空，请初始化";
    private final static String PARSE_DATA_ERROR = "解析返回数据出错";
    private final static String UPLOAD_FILE_ERROR = "上传文件出错";
    private final static String UPLOAD_FILE_FAILURE = "上传文件失败";
    private final static String BATCH_OPERATION = "批量操作只支持最多50条";
    private final static String OBJECTID_IS_NULL = "objectId为空";
    private final static String FILE_MUST_BE_LESS_THAN_10M = "文件大小超过10M";
    private final static String FILE_NOT_EXIST = "上传文件不存在";
    private final static String NO_CACHE_DATA = "没有缓存数据";
    private final static String TIME_OUT = "网络超时";
    private final static String BMOBUSER_DOES_NOT_SUPPORT_BATCH_OPERATION = "BmobUser类不支持批量操作";
    private final static String CONTEXT_IS_NULL = "上下文为空";
    private final static String DATABASE_NAME_FORMAT_IS_NOT_CORRECT = "BmobObject（数据表名称）格式不正确";
    private final static String AUTHORIZATION_IS_FAILURE = "第三方账号授权失败";
    private final static String OTHER_ERROR = "错误";
    private final static String NETWORK_IS_NOT_AVAILABLE = "无网络连接，请检查您的手机网络.";
    private final static String THIRD_LOGIN_ERROR = "第三方登录出现错误";
    private final static String PARAMETER_IS_NULL = "参数不能为空";
    private final static String FORMAT_IS_NOT_CORRECT = "格式不正确";
    private final static String USERNAME_OR_PASSWORD_IS_WRONG = "用户名或密码错误";
    private final static String EMAIL_ADDRESS_IS_VAILD = "无效的邮箱地址";

    public static String checkByCode(int code) {
        if (code == 9001) {
            return APPKEY_IS_NULL;
        }
        if (code == 9002) {
            return PARSE_DATA_ERROR;
        }
        if (code == 9003) {
            return UPLOAD_FILE_ERROR;
        }
        if (code == 9004) {
            return UPLOAD_FILE_FAILURE;
        }
        if (code == 9005) {
            return BATCH_OPERATION;
        }
        if (code == 9006) {
            return OBJECTID_IS_NULL;
        }
        if (code == 9007) {
            return FILE_MUST_BE_LESS_THAN_10M;
        }
        if (code == 9008) {
            return FILE_NOT_EXIST;
        }
        if (code == 9009) {
            return NO_CACHE_DATA;
        }
        if (code == 9010) {
            return TIME_OUT;
        }
        if (code == 9011) {
            return BMOBUSER_DOES_NOT_SUPPORT_BATCH_OPERATION;
        }
        if (code == 9012) {
            return CONTEXT_IS_NULL;
        }
        if (code == 9013) {
            return DATABASE_NAME_FORMAT_IS_NOT_CORRECT;
        }
        if (code == 9014) {
            return AUTHORIZATION_IS_FAILURE;
        }
        if (code == 9015) {
            return OTHER_ERROR;
        }
        if (code == 9016) {
            return NETWORK_IS_NOT_AVAILABLE;
        }
        if (code == 9017) {
            return THIRD_LOGIN_ERROR;
        }
        if (code == 9018) {
            return PARAMETER_IS_NULL;
        }
        if (code == 9019) {
            return FORMAT_IS_NOT_CORRECT;
        }
        if (code == 101) {
            return USERNAME_OR_PASSWORD_IS_WRONG;
        }
        if (code == 301) {
            return EMAIL_ADDRESS_IS_VAILD;
        }
        return null;
    }
}
